package string;
/*敏感词替换
键盘录入一个 字符串，如果字符串中包含（TMD），则使用***替换
 */
public class Str11 {
    public static void main(String[] args) {
        String talk= "你玩的真好，TMD，以后不要玩了CNM";
        //定义词库
        String[] arr={"TMD","SB","CNM"};
        //循环替换
        for (int i = 0; i < arr.length; i++) {
            talk= talk.replace(arr[i],"***");
        }

        System.out.println(talk);

    }
}
